<?php

class krt_tNG_delete extends krt_tNG {

	/**
		Constructor - get a reference to Kart Recordset
	*/
	function krt_tNG_delete($connection) {
		parent::krt_tNG($connection);
		$this->type = '_delete';	
	}

	function setPrimaryKey($colName, $type, $method, $reference)
	{
		$tmpVal = KT_getRealValue($method, $reference);
		if ($tmpVal != NULL) {
			$this->fields[$colName] = $tmpVal;
		}
	}
	
	/**
		This function is executed after the BEFORE triggers and just before the real SQL transaction
		We don't have a real SQL transaction so we will use this function to perform our Kart IU tasks
	*/
	function prepareSQL() {
		
			$this->kartUID = $this->fields["MXKDel"];
			if (is_array($this->kartUID)) {
				foreach ($this->kartUID as $key=>$value) {
					$idx = $this->mxKart->getIndexForUID($key);
					$this->mxKart->deleteFields($idx);
				}
			} else {
				$idx = $this->mxKart->getIndexForUID($this->kartUID);
				$this->mxKart->deleteFields($idx);
			}

		
		$this->mxKart->UpdateKart();
	}

}

?>
